package com.example.controller;

import com.example.common.Result;
import com.example.entity.XueYuanInfo;
import com.example.entity.ZhuanYeInfo;
import com.example.service.XueyuanInfoService;
import com.example.service.ZhuanyeInfoService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.ClientInfoStatus;
import java.util.List;

/**
 * @author 涛某
 * @version 1.0
 * @date 2024/3/24 11:44
 */
@RestController
@RequestMapping("/zhuanyeInfo")
public class ZhuanyeInfoController {
    @Autowired
    private ZhuanyeInfoService zhuanyeInfoService;
    @GetMapping
    public Result findAll(){
       List<ZhuanYeInfo> list =  zhuanyeInfoService.findAll();
        return Result.success(list);
    }
    @PostMapping
    public Result add(@RequestBody ZhuanYeInfo zhuanYeInfo){
        zhuanyeInfoService.add(zhuanYeInfo);

        return Result.success();
    }
    @PutMapping
    public Result update(@RequestBody ZhuanYeInfo zhuanYeInfo){
        zhuanyeInfoService.update(zhuanYeInfo);
        return Result.success();
    }
    @DeleteMapping("{id}")
    public Result del(@PathVariable() Long id){
        zhuanyeInfoService.del(id);
        return Result.success();
    }
    @GetMapping("{search}")
    public Result search(@PathVariable() String search){
       List<ZhuanYeInfo> list =  zhuanyeInfoService.search(search);
        return Result.success(list);
    }


}
